#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <cmath>
#include<stack>
using namespace std;

int main()
{
    freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    int n,i,j,k,result[100];//0:in 1:out
    char a[100],b[100];
    while(cin>>n>>a>>b)
    {
        i=j=k=0;
        stack<char>s;
        //s.push(str1[0]);
        //result[0]=1;
        while(j<n )
        {
            if(s.empty() || s.top()!=b[j] && i<n)
            {
                s.push(a[i++]); result[k++]=0;
            }
            else if(s.top()==b[j])
            {
                s.pop();
                result[k++]=1;
                j++;
            }
            else break;
        }
        if(s.empty() )
        {
            cout<<"Yes."<<endl;
            for(k=0;k<2*n;k++)
            {
                if(result[k]) cout<<"out"<<endl;
                else cout<<"in"<<endl;
            }
        }
        else cout<<"No."<<endl;
        cout<<"FINISH"<<endl;
    }
    return 0;
}
